
*************************************************************************
* PROGRAM :			replication.do
* AUTHOR :			Julia Payson, Andy Hall, and Alexander Fouirnaies 
* INFILE(S) :		"/women.dta", "prof.dta", "schoolboard_merge.dta"
* DATE WRITTEN :	September 2021
*************************************************************************

* Install dependencies
ssc install binscatter, replace
ssc install reghdfe, replace

* Set seed
set seed 1066

*************************************************************************


	* Table 1 Women Are More Likely to Work on Women's Issues
	use "women.dta", clear
	
	reghdfe cmt_women female , a( StateChamberYear) cluster(DistId) 
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_women if e(sample)
	local m1 = r(mean)

	reghdfe cmt_women female , a(DistId StateChamberYear) cluster(DistId)  
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)

	reghdfe cmt_women female log_first_women, a(DistId StateChamberYear) cluster(DistId)  
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	sum cmt_women if e(sample)
	local m3 = r(mean)

	sum log_women_bills if female == 0
	local m4 = r(mean)

	reghdfe log_women_bills female , a( StateChamberYear) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	sum log_women_bills if e(sample)
	local m4 = r(mean)

	reghdfe log_women_bills female , a(DistId StateChamberYear ) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)

	reghdfe log_women_bills female log_first_women, a(DistId StateChamberYear ) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	sum log_women_bills if e(sample)
	local m6 = r(mean)





	quietly {
		cap log close
		set linesize 255
		
		
		log using "tables_figures/table_1.tex", text replace
		
		noisily dis "\begin{table}[htbp]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Women Are More Likely to Work on Women's Issues.}"
		noisily dis "  \label{tab:main}}"
		noisily dis "\begin{tabular}{l ccc ccc} "
		noisily dis "\toprule \toprule"
		noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
		noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
		noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

		noisily dis "\midrule"
		noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
		noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
		noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
		noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


		
		noisily dis "\midrule"		
		noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
		noisily dis "District FEs & No & Yes & Yes & No & Yes & Yes  \\"
		noisily dis "Log First-Election Donations   & No & No & Yes & No & No & Yes  \\"
		noisily dis "from Health and Education   &  &  &  &  &  &   \\"
		
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{7}{p{.9\textwidth}}{\footnotesize  "
		noisily dis "Columns 1 and 4 reflect the overall difference between men and women. Columns 2 and 5 include district fixed effects "
		noisily dis " to account for district preferences. Columns 3 and 6 adjust for money raised in first election as a proxy for background. "
		noisily dis " Robust standard errors clustered by district in parentheses.}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
		
		log off
	}



	
	
	
	* Table A.1 Information on Dataset Coverage
	use "women.dta", clear
		
	gen male = female==0 & female!=.
	collapse (sum) female male (min) yearmin=year (max) yearmax=year , by(state )

	quietly {
		cap log close
		set linesize 255
		log using "tables_figures/observations_by_state.tex", text replace
		noisily dis " \begin{table}[htbp] "
		noisily dis " \caption{{\bf \# Legislator-Term Observations by State.} \label{tab:total_obs} } "
		noisily dis " \begin{center} "
		noisily dis " \begin{adjustbox}{max width=\textwidth} "
		noisily dis "\begin{tabular}{lccc | lccc}"
		noisily dis "\toprule \toprule"

		noisily dis " State  & Women &  Men & Years  & State  & Women & Men & Years  \\"
		noisily dis "\midrule"

		forval i=1 (2) 50 { 
		di state[`i']	
		noisily dis  state[`i'] " & " %4.0f female[`i'] " & " %4.0f male[`i'] " & " %4.0f yearmin[`i'] "--" %4.0f yearmax[`i']   
		noisily dis "&" state[`i'+1] " & " %4.0f female[`i'+1] " & " %4.0f male[`i'+1] " & " %4.0f yearmin[`i'+1] "--" %4.0f yearmax[`i'+1]     "\\"

		}

		
		noisily dis "\bottomrule \bottomrule"	
		noisily dis "\end{tabular}"
		noisily dis "\end{adjustbox}"
		noisily dis "\end{center}"
		noisily dis "\end{table}"
		
		log off
	}

	
	
	
	* Table A.2 # Legislator-Term Observations with Sponsorship Information
	use "women.dta", clear
	keep if log_sponsored!=.
	
	gen male = female==0 & female!=.
	collapse (sum) female male (min) yearmin=year (max) yearmax=year , by(state )

	quietly {
		cap log close
		set linesize 255
		log using "tables_figures/sponsorship_observations_by_state.tex", text replace
		noisily dis " \begin{table}[htbp] "
		noisily dis " \caption{{\bf \# Legislator-Term Observations with Sponsorship Information by State.} \label{tab:sponsorship_total_obs} } "
		noisily dis " \begin{center} "
		noisily dis " \begin{adjustbox}{max width=\textwidth} "
		noisily dis "\begin{tabular}{lccc | lccc}"
		noisily dis "\toprule \toprule"

		noisily dis " State  & Women &  Men & Years  & State  & Women & Men & Years  \\"
		noisily dis "\midrule"

		forval i=1 (2) 14 { 
		di state[`i']	
		noisily dis  state[`i'] " & " %4.0f female[`i'] " & " %4.0f male[`i'] " & " %4.0f yearmin[`i'] "--" %4.0f yearmax[`i']   
		noisily dis "&" state[`i'+1] " & " %4.0f female[`i'+1] " & " %4.0f male[`i'+1] " & " %4.0f yearmin[`i'+1] "--" %4.0f yearmax[`i'+1]     "\\"

		}

		
		noisily dis "\bottomrule \bottomrule"	
		noisily dis "\end{tabular}"
		noisily dis "\end{adjustbox}"
		noisily dis "\end{center}"
		noisily dis "\end{table}"
		
		log off
	}
	



	
	
	* Table A.3 Robustness: No Evidence of Pre-treatment Trends
	use "women.dta", clear
	drop if NumberOfSeats>1

	sort DistId StateChamberYear
	bys DistId: gen female_next = female[_n+1]
	order DistId year female female_next

	reghdfe cmt_women female , a(DistId StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_women if e(sample)
	local m1 = r(mean)

	reghdfe cmt_women female , a(DistId StateChamberYear i.DistId#c.year) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)


	reghdfe cmt_women female female_next , a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)

	local b3a = _b[female_next]
	local se3a = _se[female_next]
	sum cmt_women if e(sample)
	local m3 = r(mean)


	reghdfe log_women_bills female , a(DistId StateChamberYear) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	sum log_women_bills if e(sample)
	local m4 = r(mean)


	reghdfe log_women_bills female , a(DistId StateChamberYear i.DistId#c.year) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)

	reghdfe log_women_bills female female_next , a(DistId StateChamberYear) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	sum log_women_bills if e(sample)
	local m6 = r(mean)

	local b6a = _b[female_next]
	local se6a = _se[female_next]



		quietly {
			cap log close
			set linesize 255
			
			
			log using "tables_figures/table_1_robustness.tex", text replace
			
			noisily dis "\begin{table}[htbp]"
			noisily dis "\centering"
			noisily dis "\caption{\textbf{Robustness: No Evidence of Pre-treatment Trends.}"
			noisily dis " There is no evidence of pretreatment trends which supports the parallel trends assumption. \label{tab:main_trends}}"
			noisily dis "\begin{tabular}{l ccc ccc} "
			noisily dis "\toprule \toprule"
			noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
			noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
			noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

			noisily dis "\midrule"
			noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
			noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
			noisily dis "Woman Legislator, t+1  & "  " & "  " & " %4.2f `b3a' " & " " & "  " & " %4.2f `b6a' "\\"
			noisily dis " &  &  & (" %4.2f `se3a' ") &  &  & (" %4.2f `se6a' ")   \\[2mm]"		
			
			noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
			noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


			
			noisily dis "\midrule"		
			noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
			noisily dis "District FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
			noisily dis "District-specific Trends  & No & Yes  & No & No &  Yes  &  No \\"
			
			noisily dis "\bottomrule \bottomrule"
			noisily dis "\multicolumn{7}{p{.8\textwidth}}{\footnotesize  "
			noisily dis " The sample is restricted to single-member districts. "
			noisily dis " Robust standard errors clustered by district in parentheses.}"
			noisily dis "\end{tabular}"
			noisily dis "\end{table}"
			
			log off
		}



	
	* Table A.4 Democratic Subsample
	use "women.dta", clear
	keep if party=="Dem"


	reghdfe cmt_women female , a( StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_women if e(sample)
	local m1 = r(mean)

	reghdfe cmt_women female , a(DistId StateChamberYear) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)

	reghdfe cmt_women female log_first_women, a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	sum cmt_women if e(sample)
	local m3 = r(mean)


	sum log_women_bills if female == 0
	local m4 = r(mean)

	reghdfe log_women_bills female , a( StateChamberYear) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	sum log_women_bills if e(sample)
	local m4 = r(mean)

	reghdfe log_women_bills female , a(DistId StateChamberYear ) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)

	reghdfe log_women_bills female log_first_women, a(DistId StateChamberYear ) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	sum log_women_bills if e(sample)
	local m6 = r(mean)





	quietly {
		cap log close
		set linesize 255
		
		
		log using "tables_figures/table_1_dem.tex", text replace
		
		noisily dis "\begin{table}[htbp]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Democratic Subsample: Women Are More Likely to Work on Women's Issues.}"
		noisily dis "  \label{tab:main_dem}}"
		noisily dis "\begin{tabular}{l ccc ccc} "
		noisily dis "\toprule \toprule"
		noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
		noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
		noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

		noisily dis "\midrule"
		noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
		noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
		noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
		noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


		
		noisily dis "\midrule"		
		noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
		noisily dis "District FEs & No & Yes & Yes & No & Yes & Yes  \\"
		noisily dis "Log First-Election Donations   & No & No & Yes & No & No & Yes  \\"
		noisily dis "from Health and Education   &  &  &  &  &  &   \\"
		
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{7}{p{.9\textwidth}}{\footnotesize  "
		noisily dis "Columns 1 and 4 reflect the overall difference between men and women. Columns 2 and 5 include district fixed effects "
		noisily dis " to account for district preferences. Columns 3 and 6 adjust for money raised in first election as a proxy for background. "
		noisily dis " Robust standard errors clustered by district in parentheses.}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
		
		log off
	}
	
	
	* Table A.5 Republican Subsample
	use "women.dta", clear
	keep if party=="Rep"

	reghdfe cmt_women female , a( StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_women if e(sample)
	local m1 = r(mean)

	reghdfe cmt_women female , a(DistId StateChamberYear) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)

	reghdfe cmt_women female log_first_women, a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	sum cmt_women if e(sample)
	local m3 = r(mean)

	sum log_women_bills if female == 0
	local m4 = r(mean)

	reghdfe log_women_bills female , a( StateChamberYear) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	sum log_women_bills if e(sample)
	local m4 = r(mean)

	reghdfe log_women_bills female , a(DistId StateChamberYear ) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)

	reghdfe log_women_bills female log_first_women, a(DistId StateChamberYear ) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	sum log_women_bills if e(sample)
	local m6 = r(mean)





	quietly {
		cap log close
		set linesize 255
		
		
		log using "tables_figures/table_1_rep.tex", text replace
		
		noisily dis "\begin{table}[htbp]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Republican Subsample: Women Are More Likely to Work on Women's Issues.}"
		noisily dis "  \label{tab:main_rep}}"
		noisily dis "\begin{tabular}{l ccc ccc} "
		noisily dis "\toprule \toprule"
		noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
		noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
		noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

		noisily dis "\midrule"
		noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
		noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
		noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
		noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


		
		noisily dis "\midrule"		
		noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
		noisily dis "District FEs & No & Yes & Yes & No & Yes & Yes  \\"
		noisily dis "Log First-Election Donations   & No & No & Yes & No & No & Yes  \\"
		noisily dis "from Health and Education   &  &  &  &  &  &   \\"
		
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{7}{p{.9\textwidth}}{\footnotesize  "
		noisily dis "Columns 1 and 4 reflect the overall difference between men and women. Columns 2 and 5 include district fixed effects "
		noisily dis " to account for district preferences. Columns 3 and 6 adjust for money raised in first election as a proxy for background. "
		noisily dis " Robust standard errors clustered by district in parentheses.}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
		
		log off
	}
	



	
	
	* Figure A.1 Predicting Committee Service Using First-Election Fundraising
	use "women.dta", clear

	drop if first_total==. // drop the observations where we don't have FTM data for their first election (e.g. before 1990)

	keep CandId cmt_energy cmt_trans cmt_health cmt_fin cmt_ag cmt_educ cmt_commerce cmt_labor log_first_energy log_first_trans log_first_health log_first_fin log_first_ag log_first_educ log_first_commerce log_first_labor 
	
	collapse (max) *first* *cmt* ,by(CandId)


	reshape long  log_first_  cmt_ , i(CandId) j(sector) string


	binscatter cmt_ log_first , n(25) xtitle("Log of Industry Donations in Legislators' First Election") ytitle("Probability of Legislator Serving" "on Industry-relevant Committee") scale(1.3)
	graph export "tables_figures/money_predicting_cmt.pdf", replace




	* Table A.6 Education Fundraising Relates to Candidate Background
	use "women.dta", clear
	keep if state == "CA"
	split CandName
	drop CandName2-CandName4
	replace CandName1 = subinstr(CandName1, ",", "", .)
	gen firstinit = substr(FirstName, 1, 3)
	gen merge_name = firstinit + CandName1
	merge m:1 merge_name using "schoolboard_merge.dta"
	drop if _merge == 2
	drop _merge
	replace schoolboard = 0 if schoolboard != 1

	collapse (max) first_educ schoolboard, by(CandId)
	replace first_educ = 0 if first_educ == .
	gen log_first_educ = log(first_educ+1)
	gen raise_money = first_educ != 0

	reg first_educ schoolboard, r
	local b1 = _b[schoolboard]
	local se1 = _se[schoolboard]
	local n1 = e(N)

	reg log_first_educ schoolboard, r
	local b2 = _b[schoolboard]
	local se2 = _se[schoolboard]
	local n2 = e(N)

	reg raise_money schoolboard, r
	local b3 = _b[schoolboard]
	local se3 = _se[schoolboard]
	local n3 = e(N)

	quietly {
			cap log close
			set linesize 255
			
			log using "tables_figures/ca_validation.tex", text replace
			
			noisily dis "\begin{table}[t]"
			noisily dis "\centering"
			noisily dis "\caption{\textbf{Education Fundraising Relates to Candidate Background.}"
			noisily dis "Legislators who are former schoolboard members in California raise more money from"
			noisily dis " the education sector the first time they run for the state legislature.\label{tab:ca_validation}}"
			noisily dis "\begin{tabular}{lccc} "
			noisily dis "\toprule \toprule"
			noisily dis " & \\$ from Educ & Log \\$ from Educ + 1 & Raise Any Money from Educ \\"
			noisily dis " & (1) & (2) & (3) \\"
			noisily dis "\midrule"
			noisily dis "Schoolboard Member & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " \\ "
			noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") \\[2mm]"
			noisily dis " \# Observations & " %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' "\\"
			noisily dis "\bottomrule \bottomrule"
			noisily dis "\multicolumn{4}{p{.75\textwidth}}{\footnotesize Robust standard errors in parentheses.}"
			noisily dis "\end{tabular}"
			noisily dis "\end{table}"
			
			log off
			
	}




	* Table A.7 Heterogeneity in Committee Effects
	use "women.dta", clear

	reghdfe cmt_women female , a(DistId StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_women if e(sample)
	local m1 = r(mean)	

	reghdfe cmt_women female if female_first==1 , a(DistId StateChamberYear) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)	

	reghdfe cmt_women female if female_first==0, a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	sum cmt_women if e(sample)
	local m3 = r(mean)

	
	reghdfe log_women_bills female , a(DistId StateChamberYear ) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	sum log_women_bills if e(sample)
	local m4 = r(mean)	

	reghdfe log_women_bills female  if female_first==1, a(DistId StateChamberYear ) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)		

	reghdfe log_women_bills female if female_first==0 , a(DistId StateChamberYear ) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	sum log_women_bills if e(sample)
	local m6 = r(mean)	




		quietly {
			cap log close
			set linesize 255
			
			
			log using "tables_figures/man_to_woman_vs_woman_to_man.tex", text replace
			
			noisily dis "\begin{table}[htbp]"
			noisily dis "\centering"
			noisily dis "\caption{\textbf{Heterogeneity in committee effects depending on whether the representative switches from being a man to a woman or a woman to a man.}"
			noisily dis "  \label{tab:man_to_woman_vs_woman_to_man}}"
			noisily dis "\begin{tabular}{l ccc ccc} "
			noisily dis "\toprule \toprule"
			noisily dis "& Full  & Female  & Male to  & Full  & Female  & Male to  \\"
			noisily dis "& Sample & to Male &  Female & Sample & to Male &  Female \\[3mm]"		
			
			noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
			noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
			noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

			noisily dis "\midrule"
			noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
			noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
			noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
			noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


			
			noisily dis "\midrule"		
			noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
			noisily dis "District FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
			
			noisily dis "\bottomrule \bottomrule"
			noisily dis "\multicolumn{7}{p{.8\textwidth}}{\footnotesize  "
			noisily dis " Robust standard errors clustered by district in parentheses.}"
			noisily dis "\end{tabular}"
			noisily dis "\end{table}"
			
			log off
		}
	
	
	


	*Table A.8 Effect Heterogeneity: Variation in Effects across Legislative Professionalization

	
	
	use "women.dta", clear
	merge m:1 state using "prof.dta"
	drop _merge
	gen femaleXleg_prof = female*leg_prof

	reghdfe cmt_women female femaleXleg_prof , a( StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	local b1a = _b[femaleXleg_prof]
	local se1a = _se[femaleXleg_prof]	
	sum cmt_women if e(sample)
	local m1 = r(mean)

	reghdfe cmt_women female femaleXleg_prof, a(DistId StateChamberYear ) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local b2a = _b[femaleXleg_prof]
	local se2a = _se[femaleXleg_prof]	
	local n2 = e(N)
	sum cmt_women if e(sample)
	local m2 = r(mean)


	reghdfe cmt_women female femaleXleg_prof log_first_women , a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	local b3a = _b[femaleXleg_prof]
	local se3a = _se[femaleXleg_prof]
	sum cmt_women if e(sample)
	local m3 = r(mean)


	reghdfe log_women_bills female femaleXleg_prof , a( StateChamberYear) cluster(DistId)
	local b4 = _b[female]
	local se4 = _se[female]
	local n4 = e(N)
	local b4a = _b[femaleXleg_prof]
	local se4a = _se[femaleXleg_prof]	
	sum log_women_bills if e(sample)
	local m4 = r(mean)

	reghdfe log_women_bills female femaleXleg_prof, a(DistId StateChamberYear ) cluster(DistId)
	local b5 = _b[female]
	local se5 = _se[female]
	local b5a = _b[femaleXleg_prof]
	local se5a = _se[femaleXleg_prof]	
	local n5 = e(N)
	sum log_women_bills if e(sample)
	local m5 = r(mean)


	reghdfe log_women_bills female femaleXleg_prof log_first_women , a(DistId StateChamberYear) cluster(DistId)
	local b6 = _b[female]
	local se6 = _se[female]
	local n6 = e(N)
	local b6a = _b[femaleXleg_prof]
	local se6a = _se[femaleXleg_prof]
	sum log_women_bills if e(sample)
	local m6 = r(mean)



		quietly {
			cap log close
			set linesize 255
			
			
			log using "tables_figures/table_1_prof.tex", text replace
			
			noisily dis "\begin{table}[htbp]"
			noisily dis "\centering"
			noisily dis "\caption{\textbf{Effect Heterogeneity: Variation in Effects across Levels of Legislative Professionalization.}"
			noisily dis " There is no evidence of pretreatment trends which supports the parallel trends assumption. \label{tab:prof}}"
			noisily dis "\begin{tabular}{l ccc ccc} "
			noisily dis "\toprule \toprule"
			noisily dis "& (1) & (2) & (3)  & (4) & (5) & (6)     \\"
			noisily dis " & \multicolumn{3}{c}{Member of Committees} &\multicolumn{3}{c}{Log \# of Bills} \\"
			noisily dis " & \multicolumn{3}{c}{on Health or Education} &\multicolumn{3}{c}{on Health or Education} \\"

			noisily dis "\midrule"
			noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3' " & " %4.2f `b4' " & " %4.2f `b5' " & " %4.2f `b6' "\\"
			noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
			noisily dis "Woman Legislator $\times$  & " %4.2f `b1a' " & " %4.2f `b2a' " & " %4.2f `b3a' " & " %4.2f `b4a' " & " %4.2f `b5a' " & " %4.2f `b6a' "\\"
			noisily dis " Professionalization & (" %4.2f `se1a' ") & (" %4.2f `se2a' ") & (" %4.2f `se3a' ") & (" %4.2f `se4a' ") & (" %4.2f `se5a' ") & (" %4.2f `se6a' ")   \\[2mm]"		
			
			noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6' " \\"
			noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3' "  & " %4.2f `m4' " & " %4.2f `m5' " & " %4.2f `m6'  "\\"


			
			noisily dis "\midrule"		
			noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes & Yes & Yes & Yes  \\"
			noisily dis "District FEs & No & Yes & Yes & No & Yes & Yes  \\"
			noisily dis "Log First-Election Donations   & No & No & Yes & No & No & Yes  \\"
			noisily dis "from Health and Education   &  &  &  &  &  &   \\"
			
			noisily dis "\bottomrule \bottomrule"
			noisily dis "\multicolumn{7}{p{.8\textwidth}}{\footnotesize  "
			noisily dis " The sample is restricted to single-member districts. "
			noisily dis " Robust standard errors clustered by district in parentheses.}"
			noisily dis "\end{tabular}"
			noisily dis "\end{table}"
			
			log off
		}
	
	
	


					
	
	* Table A.9 Women Are Less Likely to Work on Traditional Men's Issues
	use "women.dta", clear

	reghdfe cmt_men female , a( StateChamberYear) cluster(DistId)
	local b1 = _b[female]
	local se1 = _se[female]
	local n1 = e(N)
	sum cmt_men if e(sample)
	local m1 = r(mean)

	reghdfe cmt_men female , a(DistId StateChamberYear) cluster(DistId)
	local b2 = _b[female]
	local se2 = _se[female]
	local n2 = e(N)
	sum cmt_men if e(sample)
	local m2 = r(mean)

	reghdfe cmt_men female log_first_women, a(DistId StateChamberYear) cluster(DistId)
	local b3 = _b[female]
	local se3 = _se[female]
	local n3 = e(N)
	sum cmt_men if e(sample)
	local m3 = r(mean)


	quietly {
		cap log close
		set linesize 255
		
		
		log using "tables_figures/mens_cmt.tex", text replace
		
		noisily dis "\begin{table}[htbp]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Women Are Less Likely to Work on traditional Men's Issues.}"
		noisily dis "  \label{tab:men}}"
		noisily dis "\begin{tabular}{l ccc } "
		noisily dis "\toprule \toprule"
		noisily dis "& (1) & (2) & (3)    \\"
		noisily dis " & \multicolumn{3}{c}{Member of Committees} \\"
		noisily dis " & \multicolumn{3}{c}{on Commerce or Finance}  \\"

		noisily dis "\midrule"
		noisily dis "Woman Legislator & " %4.2f `b1' " & " %4.2f `b2' " & " %4.2f `b3'  "\\"
		noisily dis " & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ")   \\[2mm]"
		noisily dis " \# Observations & "  %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3'  " \\"
		noisily dis "Baseline Mean & " %4.2f `m1' " & " %4.2f `m2' " & " %4.2f `m3'   "\\"


		
		noisily dis "\midrule"		
		noisily dis "Chamber-by-Year FEs & Yes & Yes & Yes   \\"
		noisily dis "District FEs & No & Yes & Yes   \\"
		noisily dis "Log First-Election Donations   & No & No & Yes   \\"
		noisily dis "from Health and Education   &  &  &    \\"
		
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{4}{p{.5\textwidth}}{\footnotesize  "
		noisily dis " Robust standard errors clustered by district in parentheses.}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
		
		log off
	}


	
	
	* Table A.10 Women and Committee Service in State Legislatures
	use "women.dta", clear

	quietly {
		cap log close
		set linesize 255
		
		
		log using "tables_figures/main_effects.tex", text replace
		
		noisily dis "\begin{table}[p]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Women Representatives and Committee Service in State Legislatures: Difference-in-Differences design.}"
		noisily dis "A woman representative is substantially more likely to serve on committees whose jurisdictions relate to issues the literature identifies as womens' issues (highlighted in grey),"
		noisily dis "relative to a hypothetical man elected from the same district at the same time. \label{tab:main_effects}}"
		noisily dis "\begin{tabular}{lr} "
		noisily dis "\toprule \toprule"
		noisily dis "Committee & \shortstack{Change in Probability \\ of Committee Assignment \\ After Electing a Woman} \\"
		noisily dis "\midrule"
		

		reghdfe cmt_women female , a(DistId StateChamberYear  ) cluster(DistId)
		sum cmt_women  if e(sample) & female == 0
		local m_women = r(mean)
		sum cmt_women  if e(sample) & female == 1
		local m_women_w = r(mean)
		noisily dis "\bf Women's Issues & \bf" %-4.3f _b[female] " \bf (" %4.3f _se[female] ") \\ \midrule"

		
		foreach v in ag approp commerce educ energy ethics fin  health judiciary labor rules social trans waysandmeans welfare {
			reghdfe cmt_`v' female , a(DistId StateChamberYear ) cluster(DistId)
		
			if "`v'"=="ag" local name="Agriculture"
			if "`v'"=="approp" local name = "Appropriations"
			if "`v'"=="commerce" local name = "Commerce"
			if "`v'"=="educ" local name = "Education"
			if "`v'"=="energy" local name = "Energy"
			if "`v'"=="ethics" local name = "Ethics"
			if "`v'"=="fin" local name = "Finance"
			if "`v'"=="health" local name = "Health"
			if "`v'"=="judiciary" local name = "Judiciary"
			if "`v'"=="labor" local name = "Labor"
			if "`v'"=="rules" local name = "Rules"
			if "`v'"=="social" local name = "Social"
			if "`v'"=="trans" local name = "Transportation"
			if "`v'"=="waysandmeans" local name = "Ways and Means"
			if "`v'"=="welfare" local name = "Welfare"
		
			sum cmt_`v'  if e(sample) & female == 0
			local m_`v' = r(mean)
						
			sum cmt_`v'  if e(sample) & female == 1
			local m_`v'_w = r(mean)
		
			if "`v'" == "educ" | "`v'" == "health"  {
				noisily dis "\rowcolor{lightgray} `name' & " %-4.3f _b[female] " (" %4.3f _se[female] ")  \\"

			}
			else {
				noisily dis "`name' & " %-4.3f _b[female] " (" %4.3f _se[female] ") \\"
			}
		}
		
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{2}{p{.5\textwidth}}{\scriptsize Numbers in second column are twoway fixed-effects estimates."
		noisily dis "Robust standard errors clustered by district in parentheses." 
		noisily dis "The first row presents an estimate pooling over the women's issues committees, which are defined to be education and health.}" 
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
		
		log off

	}
			
		
	
